-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Mobile] - Theme colors sync #26821
[Mobile] - Theme colors sync #26821
Conversation
Size Change: 0 B Total Size: 1.19 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @geriux, Thanks for taking this on!
I wonder if after the useEditorFeature( 'color.palette' ) feature was introduced this is not needed anymore.
I think you're right that this feature is what ended up breaking this flow. I ran through the test scenarios and the only one that didn't work was the offline support (which is what would have come through on these call paths).
These calls are actually here to help populate the cached data from the device. What I'm seeing while testing Android is:
- Select a theme
- Check the editor.
- Expect to see the colors and gradients for the theme
- leave the editor.
- Check the editor again
- The colors have reverted to the default options.
Hey @chipsnyder ! Thank you for testing and for explaining why that code was added =) So I investigated a bit more and the issue was that passing down the colors/gradients as props were generating another update of the settings in the state triggered after the theme colors callback hence replacing the new colors with the old ones. I updated it to set the initial colors using I updated the builds so you can give it another test when you have time. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome job tracking this down @geriux! Thanks for adding in the description of how the bug was introduced. Tested this out on iOS and Android via the provided builds and it works great!
# Conflicts: # packages/react-native-editor/CHANGELOG.md
Gutenberg Mobile PR
-> wordpress-mobile/gutenberg-mobile#2788WordPress iOS PR
-> wordpress-mobile/WordPress-iOS#15258WordPress Android PR
-> wordpress-mobile/WordPress-Android#13327Description
Fixes an issue with theme colors not syncing correctly.
After some tests, it seems like the code removed in this PR was replacing the updated theme colors with the previous ones, this was introduced here so I wonder if after theuseEditorFeature( 'color.palette' )
feature was introduced this is not needed anymore.Update: So I investigated a bit more and the issue was that passing down the colors/gradients as props were generating another update of the settings in the state triggered after the theme colors callback hence replacing the new colors with the old ones.
I updated it to set the initial colors using
updateSettings
instead of passing them as props to prevent them from replacing newer color updates in the state.I went through the test cases of it and it looks like it's working as expected. @chipsnyder I'll add you as a reviewer because you'll have more insight related to this, am I missing something related to the theme colors that still requires this code?
How has this been tested?
Steps to test updating the theme from the app
Steps to test updating the theme from the web
Steps to test Editor Theme
Editor Theme - 1
Editor Theme - 2
Types of changes
Bug fix
Checklist: